package com.sgb.kjwl.view.ui.adapter.home;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.sgb.kjwl.R;
import com.swgk.core.view.entity.MenuEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

/**
 * 说明：商品首页导航
 * 时间：2021.06.11
 *
 * @author qianghe
 */
public class GoodsNavigationAdapter extends BaseRecycleAdapter<MenuEntity> {

    public GoodsNavigationAdapter(Context context, List<MenuEntity> menuEntityList) {
        super(context, R.layout.goods_adapter_banner_item, menuEntityList);
    }

    @Override
    public void convert(ItemViewHolder holder, MenuEntity menuEntity) {

        TextView tvName = holder.itemView.findViewById(R.id.tv_name);
        ImageView imgIcon = holder.itemView.findViewById(R.id.img_icon);

        tvName.setText(menuEntity.getName());
        Glide.with(context)
                .load(menuEntity.getAppIcon())
                .apply(new RequestOptions()
                        .error(R.drawable.user_center_def_img)
                        .placeholder(R.drawable.user_center_def_img)
                        .fallback(R.drawable.user_center_def_img))
                .into(imgIcon);
    }
}
